home *** CD-ROM | disk | FTP | other *** search
File List | 1991-08-10 | 8.6 KB | 253 lines |
-
- Motorola DSP56000 Macro Cross Assembler Version 2.02 91-08-10 21:37:24 sci.asm Page 1
-
-
-
- 1 page 132,63,1,1
- 2 opt rc
- 4
- 5 ;***************************************************************
- 6 ;* SCI.ASM -- SCI drivers *
- 7 ;* *
- 8 ;* Provides interrupt based SCI handling, and data buffering. *
- 9 ;* *
- 10 ;* This module uses registers as follows: *
- 11 ;* r3 - xmit data pointer *
- 12 ;* *
- 13 ;* Copyright (C) 1990, 1991 by Alef Null. All rights reserved. *
- 14 ;* Author(s): Jarkko Vuori, OH2LNS *
- 15 ;* Modification(s): *
- 16 ;***************************************************************
- 17
- 225
- 226 section Sci
- 227 xdef baud
- 228 xdef sci_rec,sci_xmt
- 229 xdef sci_ini,putblk
- 230 xref m_scr,m_sccr,m_srxl,m_ssr,m_tie,m_stxl,m_stxm,m_stxh
- 231
- 232 P:0000 org p:
- 233
- 460
- 461 ; Serial interface parameters
- 462 00004B00 baud equ 19200
- 463
- 464
- 465 ;****************************
- 466 ;* SCI initialization *
- 467 ;****************************
- 468 sci_ini
- 469 ; initialize SCI
- 470 IF !0
- 471 P:0000 08F4B0 movep #$0b02,x:m_scr ; async 8,n,1
- 000B02
- 472 P:0002 08F4B2 movep #20736000/(2*2*16*baud),x:m_sccr
- 000010
- 473 ELSE
- 476 ENDIF
- 477
- 478 P:0004 00000C rts
- 479
- 480
- 481 ;****************************
- 482 ;* Request to xmit block *
- 483 ;****************************
- 484 ;starting address of the block in x0
- 485 ;ending address of the block in x1
- 486 ;returns C if transmitter busy
- 487 ; NC if request accepted
- 488 putblk
- 489 ; check if transmitter running
- 490 P:0005 0AB0AC jset #m_tie,x:m_scr,putblke
- 00000F
-
-
- Motorola DSP56000 Macro Cross Assembler Version 2.02 91-08-10 21:37:24 sci.asm Page 2
- SCI port handling
-
-
- 491 ; no, start transmitting header
- 492 P:0007 440000 move x0,x:<stxblk
- 493 P:0008 450000 move x1,x:<endblk
- 494 P:0009 63F400 move #heablk,r3
- 000057
- 495 P:000B 0A0020 bset #header,x:<status
- 496 P:000C 08E374 movep p:(r3),x:m_stxl
- 497 P:000D 0A0021 bset #shift,x:<status
- 498 P:000E 0AB02C bset #m_tie,x:m_scr
- 499
- 500 P:000F 00000C putblke rts
- 501
- 502
- 503 ;****************************
- 504 ;* SCI xmitter interrupt *
- 505 ;****************************
- 506 sci_xmt
- 507 ; save registers to be used
- 508 enter scix
- 515
- 516 ; send appropriate byte of the word
- 517 P:0016 0A00A1 jset #shift,x:<status,scix1
- 00001B
- 518 P:0018 08E374 movep p:(r3),x:m_stxl
- 519 P:0019 0A0021 bset #shift,x:<status
- 520 P:001A 0C0000 jmp <scx_end
- 521 P:001B 0B0002 scix1 bchg #shftcnt,x:<status
- 522 P:001C 0E8000 jcs <scix2
- 523 P:001D 08E375 movep p:(r3),x:m_stxm
- 524 P:001E 0C0000 jmp <scx_end
- 525 P:001F 08DB76 scix2 movep p:(r3)+,x:m_stxh
- 526 P:0020 0A0001 bclr #shift,x:<status
- 527
- 528 ; whole word send
- 529 P:0021 0A0080 jclr #header,x:<status,scix3
- 00002B
- 530 ; sending header, check if end of it
- 531 P:0023 226E00 move r3,a
- 532 P:0024 44F400 move #heablk+healen,x0
- 00005B
- 533 P:0026 200045 cmp x0,a
- 534 P:0027 0E2000 jne <scx_end
- 535 ; yes, header sent, start sending datablock
- 536 P:0028 0A0000 bclr #header,x:<status
- 537 P:0029 638000 move x:<stxblk,r3
- 538 P:002A 0C0000 jmp <scx_end
- 539 ; sending datablock, check if the block has been sent
- 540 P:002B 226E00 scix3 move r3,a
- 541 P:002C 448000 move x:<endblk,x0
- 542 P:002D 200045 cmp x0,a
- 543 P:002E 0E2000 jne <scx_end
- 544 ; yes, shut down transmitter
- 545 P:002F 0AB00C bclr #m_tie,x:m_scr
- 546
- 547 ; restore registers
- 548 scx_end leave scix
- 556
-
-
- Motorola DSP56000 Macro Cross Assembler Version 2.02 91-08-10 21:37:24 sci.asm Page 3
- SCI port handling
-
-
- 557
- 558
- 559 ;****************************
- 560 ;* SCI receive interrupt *
- 561 ;****************************
- 562 sci_rec
- 563 ; save registers to be used
- 564 enter scir
- 571
- 572 ; read received character
- 573 P:003D 084434 movep x:m_srxl,x0
- 574
- 575 ; check what to do with it
- 576 P:003E 56F400 move #>'+',a
- 00002B
- 577 P:0040 56F445 cmp x0,a #>'-',a
- 00002D
- 578 P:0042 0EA000 jeq <sci_r1
- 579 P:0043 200045 cmp x0,a
- 580 P:0044 0E2000 jne <scr_end
- 581
- 582 ; decrement N
- 583 P:0045 07F08E move p:NN2,a
- 00005A
- 584 P:0047 200022 asr a
- 585 P:0048 07708E move a,p:NN2
- 00005A
- 586 P:004A 0C0000 jmp <scr_end
- 587
- 588 ; increment N
- 589 P:004B 07F08E sci_r1 move p:NN2,a
- 00005A
- 590 P:004D 200032 asl a
- 591 P:004E 07708E move a,p:NN2
- 00005A
- 592
- 593 ; restore registers
- 594 scr_end leave scir
- 602
- 603
- 604 ;****************************
- 605 ;* DATA - AREA *
- 606 ;****************************
- 607
- 608 xdef NN2
- 609
- 610 00000004 healen equ 4
- 611 heablk dc $010964
- 612 version dc 290791
- 613 samplef dc 8000 ; sample frequency
- 614 NN2 dc 32 ; accumulator count
- 615
- 616 X:0000 org x:
- 617
- 618 ; KISS-to-data queue
- 619 X:0000 000000 stxblk ds 1
- 620 X:0001 000000 endblk ds 1
-
-
- Motorola DSP56000 Macro Cross Assembler Version 2.02 91-08-10 21:37:24 sci.asm Page 4
- SCI port handling
-
-
- 621
- 622 endsec
- 623
- 624 end
- 0 Errors
- 0 Warnings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-